﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminMaster.Master" AutoEventWireup="true"
    CodeBehind="QuestionsAuditList2.aspx.cs" Inherits="ExpertMIS.QuestionsAuditList2" %>

<%@ Register Src="UserControl/AuditPagingGridView.ascx" TagName="AuditPagingGridView"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <base target="_self" />
    <script src="../js/jquery-1.3.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#<%=lbQuery.ClientID %>').click(function() {             
                // 判断用户姓名查询条件是否非空
                var questionKey = $("#<%=txQContent.ClientID %>").val();
                var isPassed = $("#<%=ddlIsPassed.ClientID %>").val();
                var expert = $("#<%=ddlExpert.ClientID %>").val();
                var domain = $("#<%=ddlDomain.ClientID %>").val();
                var userName = $("#<%=txUserName.ClientID %>").val();
                var clientIP = $("#<%=txClientIP.ClientID %>").val();
                
                var search = "{1=1";
                // HACK，此处应该为全文搜索
                if (questionKey) {
                    search = search + " AND F_Title like '%" + questionKey + "%'";
                }

                if (userName) {
                    search = search + " AND F_UserName like '%" + userName + "%'";
                }
                
                if (clientIP) {
                    search = search + " AND F_ClientIP like '%" + clientIP + "%'";
                }
                
                if (isPassed != 'all') {
                    if (isPassed == 'true') {
                        search = search + ' AND F_Status != 0';
                    } else {
                        search = search + ' AND F_Status = 0';
                    }
                }

                if (expert && expert != "-1") {
                    search = search + " AND F_OID in (select F_QuestionOID from T_QUE_QuestToExperts WHERE F_ExpertOID =  '" + expert + "')";
                }

                if (domain && domain != "-1") {
                    search = search + " AND  F_OID in (select F_QuestionOID from T_QUE_QuestionDomain WHERE F_DomainOID =  '" + domain + "')";
                }

                search = search + "}";

                var href = window.location.href;
                var index = href.indexOf("?");
                if (index > 0) {
                    href = href.substring(0, index);
                }

                window.location.href = href + "?action=query&search=" + escape(search);
                return false;
            });
            
            // 批量审核按钮事件
            $('#<%=btnAudit.ClientID%>').click(function() {
                window.selectQuesIDList = "";
                showModalDialog('<%=Page.ResolveUrl("~/Admin/QuetionAuditBatch.aspx")%>', window, "status:no;resizable:yes;dialogHeight:420px;dialogWidth:515px;unadorne:yes");
                
                if(window.selectQuesIDList){
                    var href = window.location.href;
                    var index = href.indexOf("?");
                    if (index > 0) {
                        href = href.substring(0, index);
                    }
                    
                    window.location.href = href + "?action=batchAudit&quesIDList={" + escape(window.selectQuesIDList) + "}";
                }
                return false;
            });
            
             // 批量删除按钮事件
            $('#<%=btnDelete.ClientID%>').click(function() {
                window.selectQuesIDList = "";
                showModalDialog('<%=Page.ResolveUrl("~/Admin/QuestionDeleteBatch.aspx")%>', window, "status:no;resizable:yes;dialogHeight:420px;dialogWidth:515px;unadorne:yes");
                
                if(window.selectQuesIDList){
                    var href = window.location.href;
                    var index = href.indexOf("?");
                    if (index > 0) {
                        href = href.substring(0, index);
                    }
                    
                    window.location.href = href + "?action=batchDelete&quesIDList={" + escape(window.selectQuesIDList) + "}";
                }
                return false;
            });
        });
    </script>
    
    <style type="text/css">
        .style1
        {
            width: 191px;
        }
    </style>
    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <div style="width:95%;">
                    <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%;">
                        <tr>
                            <td>
                                问题关键字</td>
                            <td class="style1">
                                <asp:TextBox ID="txQContent" runat="server" EnableViewState="true" Width="170px"></asp:TextBox>
                            </td>
                             <td>
                                提问领域</td>
                            <td>
                                <asp:DropDownList ID="ddlDomain" runat="server" EnableViewState="true"  Width="169px">
                                </asp:DropDownList>
                            </td>
                            <td>提问人姓名</td>
                          <td> <asp:TextBox ID="txUserName" runat="server" EnableViewState="true" Width="170px"></asp:TextBox>
                            </td>
                            <td></td><td></td><td></td>
                        </tr>
                        <tr>
                            <td>
                                &nbsp;问题状态
                            </td>
                            <td class="style1">
                                <asp:DropDownList ID="ddlIsPassed" runat="server" EnableViewState="true"  Width="172px">
                                    <asp:ListItem Selected="True" Value="all">所有问题</asp:ListItem>
                                    <asp:ListItem Value="false">待审核问题</asp:ListItem>
                                    <asp:ListItem Value="true">已审核问题</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                              <td>
                                被提问专家
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlExpert" EnableViewState="true"  runat="server" Width="169px">
                                </asp:DropDownList>
                            </td>
                              <td>提问人IP</td>
                              
                          <td> <asp:TextBox ID="txClientIP" runat="server" EnableViewState="true" Width="170px"></asp:TextBox>
                            </td>
                             <td style="text-align:left;">
                            &nbsp;|&nbsp;<asp:Button ID="btnDelete" runat="server" Text="批量删除"/>
                            </td>
                            <td style="text-align:left;">
                            &nbsp;|&nbsp;<asp:Button ID="btnAudit" runat="server" Text="批量审核"/>
                            </td>
                              <td style="text-align:left">
                    &nbsp; |&nbsp;<asp:Button ID="lbQuery" runat="server" Text="查询"></asp:Button>
                </td>
                        </tr>
                    </table>
    </div>
    <div style="height:5px; width:95%;">
        <uc1:AuditPagingGridView ID="pgvQuestions" runat="server" />
    </div>
</asp:Content>
